﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace taobaoSpider
{
    public partial class wxLogin : Form
    {
       /// <summary>
        /// 登录窗体，以MpUserInfo表为基础，其中用户名=[toUserName]  密码=[fromUserName]
       /// </summary>
        public wxLogin()
        {
            InitializeComponent();
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtUser.Text != "" && txtPwd.Text != "")
            {
                WXWS.wx_wsSoapClient client = new WXWS.wx_wsSoapClient();
                try
                {
                    if (client.GetUser(txtUser.Text, txtPwd.Text))
                    {
                        this.DialogResult = DialogResult.OK;
                        this.Close();
                        //wxFrm mainFrm = new wxFrm();
                        //this.Hide();
                        //mainFrm.ShowDialog(); //此种方法在主窗体中用Application.Exit();方法退出整个应用程序
                    }
                    else
                    {
                        MessageBox.Show("您使用的用户名或者密码不正确，请与管理员 QQ:738254624 联系");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                MessageBox.Show("请输入用户和密码,如果没有请与管理员 QQ:738254624 联系");
            }
        }

        private void btnCancle_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void wxLogin_Load(object sender, EventArgs e)
        {
            //btnLogin.Focus = true;
        }

        private void wxLogin_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                this.btnLogin_Click(sender, e);
            }
        }
    }
}
